package com.aivin.lib_englishlearn;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;
import android.widget.TextView;


public class TranslationResultWindow extends PopupWindow   {

    public TranslationResultWindow(Context context   )  {
        super(context);
        View root =initView(context);
        this.setContentView(root);
        this.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
        this.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        this.setOutsideTouchable(true);
        //this.setAnimationStyle(R.style.AnimationRightFade);// 出窗体动画效果
        ColorDrawable dw = new ColorDrawable(Color.TRANSPARENT);
        this.setBackgroundDrawable(dw);
    }



    public void updateMsg(String msg){
        if(infoTv==null || TextUtils.isEmpty(msg)){
            return;
        }
        infoTv.setText(msg);
    }
    private TextView infoTv ;
    public View initView(Context mCtx)  {
        LayoutInflater inflater = (LayoutInflater) mCtx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View rootView   = inflater.inflate(R.layout.translation_result_windowlay, null);
        infoTv = rootView.findViewById(R.id.infoTv) ;
        return rootView ;
    }





}